/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
public class CheckPhone {
    
    
    public static void main(String[] args) {
        String identification="45272419911101003x";
        boolean flag=true;
        if(identification.length()!=18){
            flag=false;
        }
        if(!(identification.startsWith("45")||identification.startsWith("40"))){
            flag=false;
            
        }
        String numstr="45272419911101003x";
        for(int i=0;i<identification.length();i++){
            char c=identification.charAt(i);
            int temp=numstr.indexOf(c);
            if(temp<0){
                flag=false;
                break;
                
            }
        }
        if(flag)
        {
            System.out.println("是合法的身份证号码");
        }
       else
        {
            System.out.println("不是合法身份证号码");
        }
    }

}
